package br.com.atomic.screens;

import android.util.Log;
import br.com.atomic.framework.Game;
import br.com.atomic.framework.Graphics.PixmapFormat;
import br.com.atomic.framework.Pixmap;
import br.com.atomic.framework.Screen;

public class SplashScreen extends Screen {

	Pixmap background;
	// AndroidSprite personagem;
	long startTime;
	int count = 0;

	public SplashScreen(Game game, String name) {
		super(game, name);
		background = game.getGraphics().newPixmap("images/splashScreen.png",
				PixmapFormat.RGB565);
		// personagem = game.getGraphics().newSprite("images/personagem.png",
		// PixmapFormat.RGB565, 89, 110);
		// personagem.setPosition(0, 0);
		startTime = System.currentTimeMillis();
	}

	@Override
	public void update(float deltaTime) {
		// personagem.update(deltaTime);

		if (System.currentTimeMillis() - startTime >= 1000) {
			count++;
			Log.i("logs", "CONTADOR-------------> " + count);
			startTime = System.currentTimeMillis();
			if (count == 5) {
				game.setScreen(new MainMenuScreen(game, "Menu Screen"));
			}
		}

	}

	@Override
	public void present(float deltaTime) {
		game.getGraphics().clear(0);
		game.getGraphics().drawPixmap(background, 0, 0);
		// game.getGraphics().drawSprite(background, 0, 0);
		// background.draw(game.getGraphics().getCanvas(), 0, 0);
		// personagem.draw(game.getGraphics().getCanvas(), 0, 0);

	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// background.dispose();

	}

}
